//设置axios的前缀路径
axios.defaults.baseURL = "/api/manage/";

//设置全局请求头Token，携带用户的令牌
//从localStorage中获取token，如果不为空，则携带token数据
let token = localStorage.getItem('token');
if(token != null)  axios.defaults.headers.common['Token'] = token;


// 响应拦截器
axios.interceptors.response.use(
    response => response.data,
    err => {
        if(err.response.status == 401){
            location.href = "../login.html";
        }
        Promise.reject(err)
    }
)